/**
 * $Id$ Copyright 2009-2012 Oak Pacific Interactive. All rights reserved.
 */
package com.shuqi.controller;

import android.content.Context;

import com.shuqi.interfaces.IEventListener;
import com.shuqi.model.FindPasswordModel;

/**
 * 
 * 
 * @author <a href="mailto:">yaozhen</a>
 * @version 2014-2-11下午6:56:13
 */
public class FindPasswordController extends ControllerBase {

    public final static int EVENT_TYPE_FINDPWDBYPHONE = 100;

    public final static int EVENT_TYPE_FINDPWDBYMAIL = 101;

    private FindPasswordModel mPhoneModel; // 点击完成设置密码

    private FindPasswordModel mMailModel;

    public FindPasswordController(Context context) {
        this.mPhoneModel = new FindPasswordModel(context, FindPasswordModel.TYPE_PHOE);
        this.mMailModel = new FindPasswordModel(context, FindPasswordModel.TYPE_MAIL);
    }

    @Override
    public void addEventListener(IEventListener listener) {
        mPhoneModel.addEventListener(listener);
        mMailModel.addEventListener(listener);
    }

    @Override
    public void handle(int eventType, Object... objs) {
        switch (eventType) {
            case EVENT_TYPE_FINDPWDBYPHONE:
                mPhoneModel.loadData(objs);
                break;
            case EVENT_TYPE_FINDPWDBYMAIL:
                mMailModel.loadData(objs);
                break;

            default:
                break;
        }
    }

    @Override
    public void onDestroy() {
        mPhoneModel.onDestroy();
        mMailModel.onDestroy();
    }

}
